<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>收入月报表-目的地运营集团数据管理平台</title>
<include file="Include:style" />
</head>
<body>
<if condition="$project_id eq NULL">
<include file="Include:header" />
<include file="Include:left" />
</if>
<div id="main">
	<!--搜索框-->
	<div class="crumbs">
		<if condition="$project_id eq NULL"><div class="crumbs-text">收入月报表</div></if>
		<div class="right">
			<a href="__APP__/Crm/income_export<if condition="NULL neq $check_year">/check_year/{$check_year}</if><if condition="NULL neq $check_project_id">/check_project_id/{$check_project_id}</if>" class="btn left ml5">导出Excel</a>
		</div>
	</div>
	<div id="content">
		<div class="table-scrollx">
			<table class="table table-bordered table-hover table-hover-contact">
				<tr class="table-header fixed-table-header">
					<td width="100" class="nowrap">
						<select name="project" class="form-control select-add w250">
							<option value="" <if condition="NULL eq $check_project_id">selected</if>>项目名称</option>
							<foreach name="result_pid_list" item="co">
								<option value="{$co['pid']}" <if condition="$check_project_id eq $co['pid']">selected</if>>{$co['name']}</option>
							</foreach>
						</select>
					</td>
					<td width="100" class="nowrap">
						<select name="year" class="form-control select-add w100">
							<option value="" <if condition="NULL eq $check_year">selected</if>>年份</option>
							<foreach name="result_year" item="co">
								<option value="{$co['year']}" <if condition="$check_year eq $co['year']">selected</if>>{$co['year']}</option>
							</foreach>
						</select>
					</td>
					<td width="50" class="nowrap">1月</td>
					<td width="50" class="nowrap">2月</td>
					<td width="50" class="nowrap">3月</td>
					<td width="50" class="nowrap">4月</td>
					<td width="50" class="nowrap">5月</td>
					<td width="50" class="nowrap">6月</td>
					<td width="50" class="nowrap">7月</td>
					<td width="50" class="nowrap">8月</td>
					<td width="50" class="nowrap">9月</td>
					<td width="50" class="nowrap">10月</td>
					<td width="50" class="nowrap">11月</td>
					<td width="50" class="nowrap">12月</td>
					<td width="50" class="nowrap">KPI</td>
					<td width="100" class="nowrap">合计</td>
					<!--<td width="50">管理</td>-->
				</tr>
				<if condition="$result eq NULL">
				<tr>
					<td colspan="16" class="text-center">暂无相关内容</td>
				</tr>
				</if>
				<foreach name="result" item="vo">
				<tr>
					<!--<td class="nowrap">{:getProjectInfoByIncome($vo['pid'])}</td>-->
					<if condition="($result_order[$vo['pid']]['imid'] eq $vo['imid'])">
					<td class="nowrap" style="vertical-align:middle" rowspan={$result_order[$vo['pid']]['count']}>{:getProjectInfoByIncome($vo['pid'])} <a href="__APP__/Crm/income_change_by_pid/pid/{$vo['pid']}" data-toggle="tooltip" data-placement="left" title="调整收入" class="mr5"><i class="glyphicon glyphicon-edit"></i></a></td>
					</if>
					<td>{$vo['year']}</td>
					<td><if condition="($vo['m1'] neq NULL)">{:float_money_two($vo['m1'])}</if></td>
					<td><if condition="($vo['m2'] neq NULL)">{:float_money_two($vo['m2'])}</if></td>
					<td><if condition="($vo['m3'] neq NULL)">{:float_money_two($vo['m3'])}</if></td>
					<td><if condition="($vo['m4'] neq NULL)">{:float_money_two($vo['m4'])}</if></td>
					<td><if condition="($vo['m5'] neq NULL)">{:float_money_two($vo['m5'])}</if></td>
					<td><if condition="($vo['m6'] neq NULL)">{:float_money_two($vo['m6'])}</if></td>
					<td><if condition="($vo['m7'] neq NULL)">{:float_money_two($vo['m7'])}</if></td>
					<td><if condition="($vo['m8'] neq NULL)">{:float_money_two($vo['m8'])}</if></td>
					<td><if condition="($vo['m9'] neq NULL)">{:float_money_two($vo['m9'])}</if></td>
					<td><if condition="($vo['m10'] neq NULL)">{:float_money_two($vo['m10'])}</if></td>
					<td><if condition="($vo['m11'] neq NULL)">{:float_money_two($vo['m11'])}</if></td>
					<td><if condition="($vo['m12'] neq NULL)">{:float_money_two($vo['m12'])}</if></td>
					<td>{:getProjectKpiByIncome($vo['pid'],$vo['year'])}</td>
					<td>{:getProjectSumYearByIncome($vo['pid'],$vo['year'])}</td>
					<!--
					<td class="nowrap">
						<a href="__APP__/Crm/income_change/imid/{$vo['imid']}" data-toggle="tooltip" data-placement="left" title="调整收入" class="mr5"><i class="glyphicon glyphicon-edit"></i></a>
					</td>
					-->
				</tr>
				</foreach>
				<tr>
					<td colspan="2" class="text-center">总计:</td>
					<td><if condition="($result_sum['m1'] neq NULL)">{:float_money_two($result_sum['m1'])}</if></td>
					<td><if condition="($result_sum['m2'] neq NULL)">{:float_money_two($result_sum['m2'])}</if></td>
					<td><if condition="($result_sum['m3'] neq NULL)">{:float_money_two($result_sum['m3'])}</if></td>
					<td><if condition="($result_sum['m4'] neq NULL)">{:float_money_two($result_sum['m4'])}</if></td>
					<td><if condition="($result_sum['m5'] neq NULL)">{:float_money_two($result_sum['m5'])}</if></td>
					<td><if condition="($result_sum['m6'] neq NULL)">{:float_money_two($result_sum['m6'])}</if></td>
					<td><if condition="($result_sum['m7'] neq NULL)">{:float_money_two($result_sum['m7'])}</if></td>
					<td><if condition="($result_sum['m8'] neq NULL)">{:float_money_two($result_sum['m8'])}</if></td>
					<td><if condition="($result_sum['m9'] neq NULL)">{:float_money_two($result_sum['m9'])}</if></td>
					<td><if condition="($result_sum['m10'] neq NULL)">{:float_money_two($result_sum['m10'])}</if></td>
					<td><if condition="($result_sum['m11'] neq NULL)">{:float_money_two($result_sum['m11'])}</if></td>
					<td><if condition="($result_sum['m12'] neq NULL)">{:float_money_two($result_sum['m12'])}</if></td>
					<td><if condition="($result_sum['kpi'] neq NULL)">{:float_money_two($result_sum['kpi'])}</if></td>
					<td><if condition="($result_sum['total'] neq NULL)">{:float_money_two($result_sum['total'])}</if></td>
				</tr>
			</table>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function(){
	//过滤信息
	$(document).on("change","[name='year']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Crm/income_month/check_project_id/{$check_project_id}/check_year/"+val;
	});
	
	$(document).on("change","[name='project']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Crm/income_month/check_year/{$check_year}/check_project_id/"+val;
	});
});
</script>
</body>
</html>